package com.zhg.javakc.modules.sale.Service;

import com.zhg.javakc.base.page.Page;
import com.zhg.javakc.base.service.BaseService;
import com.zhg.javakc.modules.sale.dao.SaleDao;
import com.zhg.javakc.modules.sale.entity.SaleEntity;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 基础用户信息模块逻辑层实现
 *
 * @author zhou
 * @version 0.1
 */
@Service
@Transactional(readOnly = true)
public class SaleService extends BaseService<SaleDao, SaleEntity> {

    @Autowired
    private SaleDao saleDao;
    @Autowired
    private JdbcRealm jdbcRealm;

    /**
     * 分页查询符合条件用户信息
     *
     * @param page
     * @param entity
     * @return
     */
    public Page<SaleEntity> findAll(Page<SaleEntity> page, SaleEntity entity) {
        // 设置分页参数
        entity.setPage(page);
        // 执行分页查询
        page.setList(saleDao.findList(entity));
        return page;
    }

    public List<String> findType() {
        return saleDao.findType();
    }

    public List<String> findGam() {
        return saleDao.findGam();
    }

    public Map findSize(String gamName) {
        Map size = saleDao.findSize(gamName);
        return size;
    }

}
